// 仓库store文件---集中管理数据
// 导入vuex模块
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex)
const store = new Vuex.Store({
	state: {
		user:{
			sex: 1,
			nickname: "",
			headimgurl:"",
			gmtExpired:'',
			isVip: false,
			userId: 0,
			isSubscribe:true,
			placename:'',
			vipExpired:0
		},
		placename:'乐喝乐喝'
	},
	mutations: {
		setUser(state,user){
			state.user.sex = user.sex || state.user.sex;
			state.user.nickname = user.nickname || state.user.nickname;
			state.user.headimgurl = user.headimgurl || state.user.headimgurl;
			state.user.isVip = user.isVip || state.user.isVip;
			state.user.vipExpired = user.vipExpired || state.user.vipExpired;
			state.user.userId = user.userId || state.user.userId;
			state.user.gmtExpired = user.gmtExpired || state.user.gmtExpired;
			state.user.placename = user.placename || state.user.placename;
			state.user.isSubscribe = user.placename || state.user.isSubscribe;
		},
		setPlaceName(state,placename){
			state.placename=placename;
		}
	},
})
export default store;